package com.snda.storage.service.sdk;

import javax.annotation.concurrent.Immutable;

/**
 * 
 * @author wangzijian@snda.com
 * 
 */
@Immutable
public final class Criteria extends ValueObject {

	public static final Criteria EMPTY = new Criteria.Builder().build();
	
	public static final String PARAMETER_PREFIX = "prefix";
	public static final String PARAMETER_MARKER = "marker";
	public static final String PARAMETER_DELIMITER = "delimiter";
	public static final String PARAMETER_MAX_KEYS = "max-keys";

	private final String marker;
	private final String prefix;
	private final String delimiter;
	private final Integer maxKeys;

	private Criteria(Builder builder) {
		this.marker = builder.marker;
		this.prefix = builder.prefix;
		this.delimiter = builder.delimiter;
		this.maxKeys = builder.maxKeys;
	}
	
	public String getMarker() {
		return marker;
	}

	public String getPrefix() {
		return prefix;
	}

	public String getDelimiter() {
		return delimiter;
	}

	public Integer getMaxKeys() {
		return maxKeys;
	}

	public static final class Builder {
		private String marker;
		private String prefix;
		private String delimiter;
		private Integer maxKeys;
		
		public Criteria build() {
			return new Criteria(this);
		}

		public Builder marker(String marker) {
			this.marker = marker;
			return this;
		}

		public Builder prefix(String prefix) {
			this.prefix = prefix;
			return this;
		}

		public Builder delimiter(String delimiter) {
			this.delimiter = delimiter;
			return this;
		}

		public Builder maxKeys(Integer maxKeys) {
			this.maxKeys = maxKeys;
			return this;
		}
	}
}
